home *** CD-ROM | disk | FTP | other *** search
/ James Discovers Math / James Discovers Math (1995)(Broderbund)[Mac-PC].iso / mac / BBINSTAL.MST < prev    next >
Text File  |  1995-06-30  |  30KB  |  1,087 lines

  1. '**************************************************************************
  2. '*                Generic install script for Broderbund Products
  3. '**************************************************************************
  4.  
  5. '$DEFINE DEBUG  ''Define for script development/debugging
  6.  
  7. ''parse command line for custom commands here
  8. GLOBAL build$
  9. GLOBAL destCfgFile$
  10. GLOBAL srcDirStr$
  11. GLOBAL canChain$
  12. GLOBAL chainWindow%
  13. DECLARE FUNCTION ParseCommand (commFlag$) AS STRING
  14.  
  15. build$ = ParseCommand("B")
  16. destCfgFile$ = build$
  17.  
  18. canChain$ = ParseCommand("X")
  19. temp$ = ParseCommand("P")
  20. IF temp$ <> "" THEN
  21.     chainWindow% = VAL(temp$)
  22. ELSE
  23.     chainWindow% = 0
  24. END IF
  25.  
  26. '$INCLUDE 'setupapi.inc'
  27. '$INCLUDE 'msdetect.inc'
  28. '$INCLUDE 'msregdb.inc'
  29.  
  30. ''Dialog ID's
  31. CONST WELCOME       = 100
  32. CONST NOMIDIWARN    = 101
  33. CONST NOWAVEWARN    = 102
  34. CONST DUPFILE        = 103
  35. CONST ASKQUIT       = 200
  36. CONST FONTERROR        = 201
  37. CONST DESTPATH      = 300
  38. CONST WININIBACKUP    = 301
  39. CONST EXITFAILURE   = 400
  40. CONST EXITQUIT      = 600
  41. CONST EXITSUCCESS   = 700
  42. CONST EXITSUCCESS1  = 701
  43. CONST EXITSUCCESS2  = 702
  44. CONST APPHELP       = 900
  45. CONST MIDILIST        = 1901
  46. CONST EXITINCOMPLETE    = 1902
  47. CONST CUSTINST     = 6200
  48. CONST TOOBIG       = 6300
  49. CONST BADPATH       = 6400
  50.  
  51. ''    Dialog Variable String IDs
  52. CONST    PRODUCTNAME    =    701
  53. CONST    CUSTSUPPNUM    =    702
  54. CONST    SUCCESSCOMMENT = 703
  55. CONST SUCCESSCOMMENT1 = 750
  56. CONST SUCCESSCOMMENT2 = 751
  57. CONST    FILEPATH    = 704
  58. CONST    CHAINTEXT    = 705
  59.  
  60. ''Bitmap ID
  61. CONST LOGO = 1
  62.  
  63. CONST BROADKEY = 30706
  64.  
  65. GLOBAL WINDRIVE$    ''Windows drive letter.
  66. GLOBAL sourceDir$    ''Install from directory.
  67. GLOBAL destDir$     ''Default destination directory.
  68. GLOBAL cfgFile$        ''Config file containing custom info for installer
  69. GLOBAL logFile$        ''Log file for installer activities
  70. GLOBAL filesInstalled%    ''0 = no files installed, 1 = files installed
  71. GLOBAL waveNeeded%    ''0 = wave device not required by product, 1 = wave device is required by product
  72. GLOBAL waveCount%    '' # of wave devices installed on system
  73. GLOBAL midiNeeded%    ''0 = MIDI device not required by product, 1 = MIDI device is required by product
  74. GLOBAL midiCount%    '' # of MIDI devices installed on system
  75. GLOBAL qtwNeeded% '' QuickTime for Windows required
  76. GLOBAL qtwVersion$ '' QuickTime for Windows version that is required
  77. GLOBAL fontsToInstall%    ''0 = no fonts need be installed, 1 = fonts need to be installed
  78. GLOBAL fontsInstalled%    ''0 = not installed, 1 = installed (partial or otherwise)
  79. GLOBAL fontInstallError%    ''0 = no error
  80. GLOBAL wingNeeded% ''0 = WinG not required, 1 = WinG required
  81. GLOBAL winIniBkpFile$    ''Backup name for WIN.INI file
  82. GLOBAL szInf$
  83. GLOBAL prodName$
  84. GLOBAL CUIDLL$
  85. GLOBAL filePathID$
  86. GLOBAL replaceAll%
  87. GLOBAL ExcessNeeded&    ''if > 0, indicates space unavailable for install
  88. GLOBAL sucCom$
  89. GLOBAL qtwSucComm$
  90. GLOBAL cmdLine$
  91. GLOBAL midiCmdLine$
  92. GLOBAL qtwCmdLine$
  93.  
  94. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  95. DECLARE FUNCTION InstantString (varStr$) AS STRING
  96. DECLARE SUB DeinstFiles
  97. DECLARE FUNCTION AddDirToCopyList (theFile$,dir$,srcDir$,dstDir$,silent%) AS INTEGER
  98. DECLARE FUNCTION SetDriveStatus (silent%) AS INTEGER
  99. DECLARE SUB DoRegistrations
  100. DECLARE FUNCTION CreateRegEntries LIB "brodreg.dll" (srcCfgFile$,dstCfgFile$,varTable$,demarChar$) AS INTEGER
  101. DECLARE FUNCTION InstallFonts LIB "brodfont.dll" (installDir$, configFile$, winBackup$) AS INTEGER
  102. DECLARE FUNCTION DeinstallFonts LIB "brodfont.dll" (configFile$, winBackup$) AS INTEGER
  103. DECLARE FUNCTION SetParentWindow LIB "brodutil.dll" (parentWindow%) AS INTEGER
  104. DECLARE FUNCTION DeleteDirectory LIB "brodutil.dll" (directory$,silent%) AS INTEGER
  105. DECLARE FUNCTION DeinstallFiles LIB "brodutil.dll" (directory$,config$,section$,remove%) AS INTEGER
  106. DECLARE FUNCTION NotifyChain LIB "brodutil.dll" (chainWindow%,wParam%,theMess$) AS INTEGER
  107. DECLARE FUNCTION PGInstall LIB "brodpgi.dll" (theFile$,silent%,showGroup%) AS INTEGER
  108. DECLARE FUNCTION PGUninstall LIB "brodpgi.dll" (theFile$,prejudice%) AS INTEGER
  109. DECLARE FUNCTION GetNetPGSize LIB "brodpgi.dll" (theFile$) AS INTEGER
  110. DECLARE FUNCTION SelectMidiDevice LIB "brodmidi.dll" (cmdLine$) AS INTEGER
  111. DECLARE FUNCTION GetDriverCount LIB "brodmidi.dll" (driverType$) AS INTEGER
  112.  
  113. INIT:
  114.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  115.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  116.  
  117.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  118.     IF szInf$ = "" THEN
  119.         szInf$ = GetSymbolValue("STF_CWDDIR") + "BBINSTAL.INF"
  120.     ELSE
  121.         SPLITPATH szInf$,bDrive$,bDir$,bFile$,bExt$
  122.         IF bDrive$ = "" THEN
  123.             szInf$ = GetSymbolValue("STF_CWDDIR")+szInf$
  124.         END IF
  125.     END IF
  126.     ReadInfFile szInf$
  127.  
  128.     WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
  129.     sourceDir$ = GetSymbolValue("STF_SRCDIR")
  130.     IF LEN(sourceDir$) > 3 THEN
  131.         sourceDir$ = Mid$(sourceDir$,1,LEN(sourceDir$)-1)
  132.     END IF
  133.  
  134.  
  135. ''GET CONFIG FILE INFO
  136.     SPLITPATH szInf$,bDrive$,bDir$,bFile$,bExt$
  137.     cfgFile$ = MakePath(sourceDir$,bFile$+".BDF")
  138.     IF DoesFileExist(cfgFile$,femExists) = 1 THEN
  139.         destDir$ = WINDRIVE$+":\"+GetIniKeyString(cfgFile$,"directories","TargetDir")
  140.         IF destDir$ <> "" THEN
  141.             logFile$ = MakePath(destDir$, "LOGFILE.OUT")
  142.         ELSE
  143.             logFile$ = ""
  144.         END IF
  145.         prodName$ = GetIniKeyString(cfgFile$, "product", "ProductName")
  146.         waveNeeded% = VAL(GetIniKeyString(cfgFile$,"general","wavedevice"))
  147.         midiNeeded% = VAL(GetIniKeyString(cfgFile$,"general","mididevice"))
  148.         qtwNeeded% = VAL(GetIniKeyString(cfgFile$,"quicktime","qtwRequired"))
  149.         qtwVersion$ = GetIniKeyString(cfgFile$,"quicktime","qtwVersion")
  150.         fontsToInstall% = VAL(GetIniKeyString(cfgFile$,"general","fontinstall"))
  151.       wingNeeded% = VAL(GetIniKeyString(cfgFile$,"general","wing"))
  152.         sucCom$ = GetIniKeyString(cfgFile$,"general","successcomment")
  153.         ''cmdLine$ = GetIniKeyString(cfgFile$,"general","chaincommand")
  154.         midiCmdLine$ = GetIniKeyString(cfgFile$,"general","chaincommand") ''temporary solution
  155.         qtwCmdLine$ = GetIniKeyString(cfgFile$,"quicktime","qtwCmdLine")
  156.         qtwSucComm$ = GetIniKeyString(cfgFile$,"quicktime","qtwsuccomm")
  157.     ELSEIF build$ <> "" THEN
  158.         cfgFile$ = destCfgFile$
  159.         destDir$ = GetIniKeyString(cfgFile$,"directories","MediaBuildDir")
  160.         IF destDir$ = "" THEN
  161.             destDir$ = WINDRIVE$+":\BRODINST"
  162.         END IF
  163.         IF destCfgFile$ <> "" THEN
  164.             SPLITPATH cfgFile$,bDrive$,bDir$,bFile$,bExt$
  165.             logFile$ = bDrive$+bDir+"LOGFILE.OUT"
  166.         ELSEIF IsDirWritable(sourceDir$) = 1 THEN
  167.             logFile$ = MakePath(sourceDir$, "LOGFILE.OUT")
  168.         ELSE
  169.             logFile$ = ""
  170.         END IF
  171.         prodName$ = "Installer for "+GetIniKeyString(cfgFile$, "product", "ProductName")
  172.         waveNeeded% = 0
  173.         midiNeeded% = 0
  174.         qtwNeeded% = 0
  175.         qtwVersion$ = ""
  176.         fontsToInstall% = 0
  177.       wingNeeded% = 0
  178.         sucCom$ = ""
  179.         cmdLine$ = ""
  180.         midiCmdLine$ = ""
  181.         qtwCmdLine$ = ""
  182.       qtwSucComm$ = ""
  183.     ELSE
  184.         cfgFile$ = ""
  185.         destDir$ = WINDRIVE$+":\BRODINST"
  186.         prodName$ = "Unspecified Product"
  187.         waveNeeded% = 0
  188.         midiNeeded% = 0
  189.         qtwNeeded% = 0
  190.         qtwVersion$ = ""
  191.         fontsToInstall% = 0
  192.         wingNeeded% = 0
  193.         sucCom$ = ""
  194.         cmdLine$ = ""
  195.         midiCmdLine$ = ""
  196.         qtwCmdLine$ = ""
  197.       qtwSucComm$ = ""
  198.         IF IsDirWritable(sourceDir$) = 1 THEN
  199.             logFile$ = MakePath(sourceDir$, "LOGFILE.OUT")
  200.         ELSE
  201.             logFile$ = ""
  202.         END IF
  203.     END IF
  204.  
  205.     filesInstalled% = 0
  206.     waveCount% = 0
  207.     midiCount% = 0
  208.     fontsInstalled% = 0
  209.     fontInstallError% = 0
  210.     winIniBkpFile$ = "WIN.BAK"
  211.     skip% = 0
  212.  
  213.     prodNameID$ = LTRIM$(STR$(PRODUCTNAME))
  214.     AddListItem "VarStringID", prodNameID$
  215.     SetSymbolValue prodNameID$,prodName$
  216.  
  217.     filePathID$ = LTRIM$(STR$(FILEPATH))
  218.     AddListItem "VarStringID", filePathID$
  219.  
  220.     something% = SetParentWindow(HwndFrame())
  221.  
  222.     SetBitmap CUIDLL$, LOGO
  223.     SetTitle GetSymbolValue(prodNameID$)
  224.     ExcessNeeded& = 0
  225.  
  226.     ''CustInst list symbols
  227.     FOR i% = 1 TO 7 STEP 1
  228.         AddListItem "DriveStatusText", ""
  229.     NEXT i%
  230.     IF destDir$ <> "" THEN
  231.         ReplaceListItem "DriveStatusText", 7, destDir$
  232.     END IF
  233.  
  234.     ''Disk cost list symbols
  235.     FOR i% = 1 TO 26 STEP 1
  236.         AddListItem "ExtraCosts", "0"
  237.      NEXT i%
  238.  
  239.     IF build$ <> "" THEN
  240.         srcDirStr$ = GetIniKeyString(cfgFile$, "build", "sourcedir")
  241.     ELSE
  242.         srcDirStr$ = GetIniKeyString(cfgFile$,"directories","sourcedir")
  243.     END IF
  244.  
  245. '$IFDEF DEBUG
  246.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  247.     IF IsDriveValid(WINDRIVE$) = 0 THEN
  248.         i% = DoMsgBox("Windows drive ('"+WINDRIVE$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
  249.         GOTO QUIT
  250.     END IF
  251. '$ENDIF ''DEBUG
  252.  
  253.  
  254. WELCOME:
  255.     SetSymbolValue "CENTERWINDOW", "BOTH"
  256.     SetSymbolValue "OFFSETVERTPERC", "-10"
  257.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  258.     IF sz$ = "CONTINUE" THEN
  259.           UIPop 1
  260.     ELSE
  261.         GOSUB ASKQUIT
  262.         GOTO WELCOME
  263.     END IF
  264.  
  265. WAVESELECT:
  266.     IF waveNeeded% = 0 THEN
  267.         GOTO WAVESELECTEND
  268.     END IF
  269.  
  270.     waveCount% = GetDriverCount("wave")
  271.     IF waveCount% > 0 THEN
  272.         GOTO WAVESELECTEND
  273.     END IF
  274.  
  275.     sz$ = UIStartDlg(CUIDLL$,NOWAVEWARN,"FInfoDlgProc",APPHELP,HELPPROC$)
  276.     IF sz$ = "CONTINUE" THEN
  277.         UIPop 1
  278.         AddListItem "IncompleteInstall", "Your system has no wave drivers installed."
  279.         GOTO WAVESELECTEND
  280.     ELSE
  281.         GOSUB ASKQUIT
  282.         GOTO WAVESELECT
  283.     END IF
  284. WAVESELECTEND:
  285.  
  286.  
  287. MIDISELECT:
  288.     IF midiNeeded% = 0 THEN
  289.         GOTO MIDISELECTEND
  290.     END IF
  291.  
  292.     midiCount% = GetDriverCount("midi")
  293.     IF midiCount% > 0 THEN
  294.         IF cmdLine$ <> "" THEN
  295.             cmdLine$ = cmdLine$+";"
  296.             cmdLine$ = cmdLine$+midiCmdLine$
  297.         ELSE
  298.           cmdLine$ = midiCmdLine$
  299.         END IF
  300.         GOTO MIDISELECTEND
  301.     END IF
  302.  
  303.     sz$ = UIStartDlg(CUIDLL$,NOMIDIWARN,"FInfoDlgProc",APPHELP,HELPPROC$)
  304.     IF sz$ = "CONTINUE" THEN
  305.         UIPop 1
  306.         AddListItem "IncompleteInstall", "Your system has no MIDI drivers installed."
  307. ''        cmdLine$ = ""
  308.         GOTO MIDISELECTEND
  309.     ELSE
  310.         GOSUB ASKQUIT
  311.         GOTO MIDISELECT
  312.     END IF
  313. MIDISELECTEND:
  314.  
  315.  
  316. QTWSELECT:
  317.     IF qtwNeeded% = 0 THEN
  318.         GOTO QTWSELECTEND
  319.     ENDIF
  320.  
  321.     verString$ = GetVersionOfFile(GetWindowsSysDir+"QTIM.DLL")
  322.     IF verString$ < qtwVersion$ THEN
  323.         IF GetWindowsMajorVersion() = 3 AND GetWindowsMinorVersion() < 20 THEN
  324.         ELSE
  325.             qtwCmdLine95$ = GetIniKeyString(cfgFile$,"quicktime","qtw95CmdLine")
  326.             IF qtwCmdLine$ <> "" THEN
  327.              qtwCmdLine$ = qtwCmdLine$+";"+qtwCmdLine95$
  328.             END IF
  329.         END IF
  330.     ELSE
  331.         qtwCmdLine$ = ""
  332.         GOTO QTWSELECTEND
  333.     END IF
  334.  
  335.     IF cmdLine$ <> "" THEN
  336.         cmdLine$ = cmdLine$+";"
  337.         cmdLine$ = cmdLine$+qtwCmdLine$
  338.     ELSE
  339.         cmdLine$ = qtwCmdLine$
  340.     END IF
  341. QTWSELECTEND:
  342.  
  343.  
  344. CUSTINST:
  345.     result% = SetDriveStatus(1)
  346.     sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
  347.  
  348.     IF sz$ = "CONTINUE" THEN
  349.         ''Install only if it will fit.
  350.         IF ExcessNeeded& > 0 THEN
  351.             GOSUB TOOBIG
  352.             GOTO CUSTINST
  353.         END IF
  354.         UIPop 1
  355.     ELSEIF sz$ = "PATH" THEN
  356.         GOTO GETPATH
  357.     ELSEIF sz$ = "REACTIVATE" THEN
  358.         GOTO CUSTINST
  359.     ELSEIF sz$ = "EXIT" THEN
  360.         GOSUB ASKQUIT
  361.         GOTO CUSTINST
  362.     ELSEIF sz$ = "BACK" THEN
  363.         UIPop 1
  364.         GOTO WELCOME
  365.     ELSE
  366.         GOSUB ASKQUIT
  367.         GOTO CUSTINST
  368.     END IF
  369.     result% = SetDriveStatus(0)
  370.     IF result% = 1 THEN
  371.         GOTO CUSTINST
  372.     END IF
  373.  
  374.  
  375.     IF fontsToInstall% = 0 THEN
  376.         GOTO GETWINIBKUPEND
  377.     END IF
  378. GETWINIBKUP:
  379.     SetSymbolValue "EditTextIn", winIniBkpFile$
  380.     SetSymbolValue "EditFocus", "END"
  381. GETWINIBKUPL1:
  382.     sz$ = UIStartDlg(CUIDLL$, WININIBACKUP, "FEditDlgProc", APPHELP, HELPPROC$)
  383.     winIniBkpFile$ = GetWindowsDir()+GetSymbolValue("EditTextOut")
  384.  
  385.     IF sz$ = "CONTINUE" THEN
  386.         UIPop 1
  387.     ELSEIF sz$ = "REACTIVATE" THEN
  388.         GOTO GETWINIBKUPL1
  389.     ELSEIF sz$ = "BACK" THEN
  390.         UIPop 1
  391.         GOTO CUSTINST
  392.     ELSE
  393.         GOSUB ASKQUIT
  394.         GOTO GETWINIBKUP
  395.     END IF
  396.  
  397.     CopyFile GetWindowsDir()+"WIN.INI", winIniBkpFile$, cmoOverwrite, 0
  398. GETWINIBKUPEND:
  399.  
  400.  
  401.     ''BEGIN INSTALLATION PROCESS
  402.     listLen% = GetListLength("NEWDIRLIST")
  403.     SetSymbolValue "BASE0$",destDir$
  404.     FOR i% = 1 TO listLen% STEP 1
  405.         theDir$ = InstantString(GetListItem("NEWDIRLIST",i%))
  406.         IF theDir$ <> "" THEN
  407.             CreateDir theDir$, cmoVital
  408.             ReplaceListItem "DIRLIST",i%,theDir$
  409.         END IF
  410.     NEXT
  411.     RemoveSymbol "BASE0$"
  412.  
  413.     IF logFile$ <> "" THEN
  414.         IF build$ = "" THEN
  415.             logFile$ = MakePath(destDir$, "LOGFILE.OUT")
  416.         END IF
  417.         OpenLogFile logFile$, 0
  418.         WriteToLogFile "  Destination directory: '" + destDir$ + "'"
  419.     END IF
  420.  
  421.     ''INSTALL FILES
  422.     filesInstalled% = 1
  423.     CopyFilesInCopyList
  424.     ClearCopyList
  425.  
  426.  
  427.     IF build$ = "" THEN
  428.         IF cfgFile$ <> "" THEN
  429.             ''COPY INSTALLER CONFIG FILE TO DEST DIR, AND UPDATE WITH RUNTIME INFO
  430.             SPLITPATH szInf$,bDrive$,bDir$,bFile$,bExt$
  431.             destCfgFile$ = MakePath(destDir$,bFile$+".CFG")
  432.             CopyFile cfgFile$, destCfgFile$, cmoOverwrite, 0
  433.  
  434.           ''[directories] section contains directory listings with no trailing \
  435.             IF INSTR(LEN(sourceDir$),sourceDir$,"\") > 0 THEN
  436.                 tempString$ = MID$(sourceDir$,1,LEN(sourceDir$)-1)
  437.             ELSE
  438.                 tempString$ = sourceDir$
  439.             END IF
  440.             CreateIniKeyValue destCfgFile$,"directories","InstallFromDir",tempString$, cmoOverwrite
  441.             IF INSTR(LEN(destDir$),destDir$,"\") > 0 THEN
  442.                 tempString$ = MID$(destDir$,1,LEN(destDir$)-1)
  443.             ELSE
  444.                 tempString$ = destDir$
  445.             END IF
  446.             CreateIniKeyValue destCfgFile$,"directories","InstallToDir",tempString$, cmoOverwrite
  447.  
  448.         ''[install] section contains directory listings with a trailing \
  449.             IF INSTR(LEN(sourceDir$),sourceDir$,"\") > 0 THEN
  450.                 tempString$ = sourceDir$
  451.             ELSE
  452.                 tempString$ = sourceDir$+"\"
  453.             END IF
  454.             CreateIniKeyValue destCfgFile$,"install","InstallFromDir",tempString$, cmoOverwrite
  455.  
  456.             IF INSTR(LEN(destDir$),destDir$,"\") > 0 THEN
  457.                 tempString$ = destDir$
  458.             ELSE
  459.                 tempString$ = destDir$+"\"
  460.             END IF
  461.             CreateIniKeyValue destCfgFile$,"install","InstallToDir",tempString$, cmoOverwrite
  462.  
  463.             CreateIniKeyValue destCfgFile$, "install","InstallFromDrive", MID$(sourceDir$,1,1), cmoOverwrite
  464.             CreateIniKeyValue destCfgFile$, "install","InstallToDrive", MID$(destDir$,1,1), cmoOverwrite
  465.         ELSE
  466.             destCfgFile$ = ""
  467.         END IF
  468.     ELSEIF destCfgFile$ <> "" THEN
  469.         CreateIniKeyValue destCfgFile$,"directories","MediaBuildDir",destDir$,cmoOverwrite
  470.     END IF
  471.  
  472.     ''INSTALL FONTS - IF NECESSARY
  473.     IF fontsToInstall% = 0 THEN
  474.         GOTO FONTINSTALLEND
  475.     END IF
  476. FONTINSTALL:
  477.     fontInstallError% = InstallFonts(destDir$,destCfgFile$,winIniBkpFile$)
  478.     IF fontInstallError% > 0 THEN
  479.         sz$ = UIStartDlg(CUIDLL$, FONTERROR, "FQuitDlgProc", 0, "")
  480.         IF sz$ = "EXIT" THEN
  481.             UIPopAll
  482.             ERROR STFQUIT
  483.         ELSEIF sz$ = "REACTIVATE" THEN
  484.             GOTO FONTINSTALL
  485.         ELSE
  486.             UIPop 1
  487.         END IF
  488.         AddListItem "IncompleteInstall", "Fonts are not installed correctly for this product."
  489.     END IF
  490.     fontsInstalled% = 1
  491. FONTINSTALLEND:
  492.  
  493.  
  494.     ''INSTALL PROGRAM GROUP AND PROGRAM GROUP ITEMS
  495.      IF build$ = "" THEN
  496.         progGroup$ = GetIniKeyString(destCfgFile$,"proggroup","groupname")
  497.         CreateProgmanGroup progGroup$,"",cmoVital
  498.         IF GetWindowsMajorVersion() = 3 AND GetWindowsMinorVersion() < 20 THEN
  499.             anerror% = PGInstall(destCfgFile$,1,1)
  500.         ELSE
  501.             anerror% = PGInstall(destCfgFile$,1,6)
  502.         END IF
  503.     END IF
  504.  
  505.     IF INSTR(LEN(sourceDir$),sourceDir$,"\") > 0 THEN
  506.         varTable$ = "INSTALLFROMDIR|"+MID$(sourceDir$,1,LEN(sourceDir$)-1)
  507.     ELSE
  508.         varTable$ = "INSTALLFROMDIR|"+sourceDir$
  509.     END IF
  510.     IF destDir$ <> "" THEN
  511.         IF INSTR(LEN(destDir$),destDir$,"\") > 0 THEN
  512.             varTable$ = varTable$+"|INSTALLTODIR|"+MID$(destDir$,1,LEN(destDir$)-1)
  513.         ELSE
  514.             varTable$ = varTable$+"|INSTALLTODIR|"+destDir$
  515.         END IF
  516.     END IF
  517.  
  518.     result% = CreateRegEntries(cfgFile$,MakePath(destDir$,"install.log"),varTable$,"|")
  519.     ''DoRegistrations
  520.  
  521.     IF logFile$ <> "" THEN
  522.         CloseLogFile
  523.     END IF
  524.  
  525.  
  526. QUIT:
  527.     ON ERROR GOTO ERRQUIT
  528.  
  529.     IF ERR = 0 THEN
  530.         GOTO GOODQUIT
  531.     ELSE
  532.         GOTO BADQUIT
  533.     ENDIF
  534.  
  535. GOODQUIT:
  536.     IF GetListLength("IncompleteInstall") THEN
  537.         SetSymbolValue "ListItemsIn", ""
  538.         FOR i% = 1 TO GetListLength("IncompleteInstall") STEP 1
  539.             AddListItem "ListItemsIn", GetListItem("IncompleteInstall",i%)
  540.         NEXT
  541. INCOMPLETEQUITL1:
  542.         sz$ = UIStartDlg(CUIDLL$,EXITINCOMPLETE,"FList0DlgProc",0,"")
  543.         IF sz$ = "REACTIVATE" THEN
  544.             GOTO INCOMPLETEQUITL1
  545.         END IF
  546.         UIPop 1
  547.         GOTO ENDINSTALL
  548.     ELSEIF cmdLine$ = "" THEN
  549. GOODQUITL0:
  550.         sucComID$ = LTRIM$(STR$(SUCCESSCOMMENT))
  551.         AddListItem "VarStringID", sucComID$
  552.         IF sucCom$ = "" THEN
  553.             sucCom$ = "Have Fun!"
  554.         END IF
  555.         SetSymbolValue sucComID$,sucCom$
  556.  
  557.         sz$ = UIStartDlg(CUIDLL$,EXITSUCCESS,"FList0DlgProc",0,"")
  558.         IF sz$ = "REACTIVATE" THEN
  559.             GOTO GOODQUITL0
  560.         END IF
  561.         UIPop 1
  562.         GOTO ENDINSTALL
  563.     ELSEIF midiCmdLine$ <> "" THEN
  564.         sucCom1$ = sucCom$
  565.         dlg% = EXITSUCCESS1
  566.         IF qtwCmdLine$ <> "" THEN
  567.             sucCom2$ = qtwSucComm$
  568.             dlg% = EXITSUCCESS2
  569.             GOTO TWOCHAIN
  570.         ELSE
  571.             GOTO ONECHAIN
  572.         END IF
  573.     ELSEIF qtwCmdLine$ <> "" THEN
  574.         sucCom1$ = qtwSucComm$
  575.       dlg% = EXITSUCCESS1
  576.         GOTO ONECHAIN
  577.     ELSE
  578.        GOTO GOODQUITL0
  579.     END IF
  580.  
  581. TWOCHAIN:
  582.     sucComID2$ = LTRIM$(STR$(SUCCESSCOMMENT2))
  583.     AddListItem "VarStringID", sucComID2$
  584.     SetSymbolValue sucComID2$,sucCom2$
  585. ONECHAIN:
  586.     sucComID1$ = LTRIM$(STR$(SUCCESSCOMMENT1))
  587.     AddListItem "VarStringID", sucComID1$
  588.     SetSymbolValue sucComID1$,sucCom1$
  589.  
  590.     chainID$ = LTRIM$(STR$(CHAINTEXT))
  591.     AddListItem "VarStringID", chainID$
  592.  
  593. GOODQUITL1:
  594.     IF canChain$ = "Y" THEN
  595.     ''SET VARIABLES FOR COMMAND LINE
  596.     ''SET COMMAND LINE
  597.     ''SEND COMMAND LINE TO PARENT EXECUTABLE
  598.         IF INSTR(LEN(destDir$),destDir$,"\") > 0 THEN
  599.             tempString$ = MID$(destDir$,1,LEN(destDir$)-1)
  600.         ELSE
  601.             tempString$ = destDir$
  602.         END IF
  603.         SetSymbolValue "INSTALLTODIR$",tempString$
  604.         IF INSTR(LEN(sourceDir$),sourceDir$,"\") > 0 THEN
  605.             tempString$ = MID$(sourceDir$,1,LEN(sourceDir$)-1)
  606.         ELSE
  607.             tempString$ = sourceDir$
  608.         END IF
  609.         SetSymbolValue "INSTALLFROMDIR$",tempString$
  610.         SetSymbolValue "WINDOWS$",MID$(GetWindowsDir(),1,LEN(GetWindowsDir())-1)
  611.         SetSymbolValue "WINSYS$",MID$(GetWindowsSysDir(),1,LEN(GetWindowsSysDir())-1)
  612.         anerror% = NotifyChain(chainWindow%,0,InstantString(cmdLine$))
  613.         chainTxt$ = "Press OK to continue"
  614.     ELSE
  615.         chainTxt$ = "Please refer to the documentation for instructions on how to do this."
  616.     END IF
  617.  
  618.     SetSymbolValue chainID$,chainTxt$
  619.  
  620.     sz$ = UIStartDlg(CUIDLL$,dlg%,"FList0DlgProc",0,"")
  621.     IF sz$ = "REACTIVATE" THEN
  622.         GOTO GOODQUITL1
  623.     END IF
  624.     UIPop 1
  625. ENDINSTALL:
  626.     END
  627.  
  628. BADQUIT:
  629.     IF ERR = STFQUIT THEN
  630.         dlg% = EXITQUIT
  631.     ELSE
  632.         dlg% = EXITFAILURE
  633.     END IF
  634.     DeinstFiles
  635. BADQUITL1:
  636.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  637.     IF sz$ = "REACTIVATE" THEN
  638.         GOTO BADQUITL1
  639.     END IF
  640.     UIPop 1
  641.     END
  642.  
  643. ERRQUIT:
  644.     DeinstFiles
  645.     i% = DoMsgBox("Setup sources were corrupted, call 555-1212!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  646.     END
  647.  
  648.  
  649. TOOBIG:
  650.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  651.     IF sz$ = "REACTIVATE" THEN
  652.         GOTO TOOBIG
  653.     END IF
  654.     UIPop 1
  655.     RETURN
  656.  
  657.  
  658.  
  659. BADPATH:
  660.      sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  661.     IF sz$ = "REACTIVATE" THEN
  662.         GOTO BADPATH
  663.     END IF
  664.     UIPop 1
  665.     RETURN
  666.  
  667.  
  668.  
  669. ASKQUIT:
  670.     SetSymbolValue "OFFSETVERTPERC", "-20"
  671.     SetSymbolValue "OFFSETHORZPERC", "10"
  672.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  673.     RemoveSymbol "OFFSETHORZPERC"
  674.     SetSymbolValue "OFFSETVERTPERC", "-10"
  675.  
  676.     IF sz$ = "EXIT" THEN
  677.         UIPopAll
  678.         ERROR STFQUIT
  679.     ELSEIF sz$ = "REACTIVATE" THEN
  680.         GOTO ASKQUIT
  681.     ELSE
  682.         UIPop 1
  683.     END IF
  684.     RETURN
  685.  
  686.  
  687. GETPATH:
  688.     SetSymbolValue "EditTextIn", destDir$
  689.     SetSymbolValue "EditFocus", "END"
  690. GETPATHL1:
  691.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  692.  
  693.     IF sz$ = "CONTINUE" THEN
  694.         olddest$ = destDir$
  695.         destDir$ = GetSymbolValue("EditTextOut")
  696.  
  697.         ''Validate new path.
  698.         IF IsDirWritable(destDir$) = 0 THEN
  699.             GOSUB BADPATH
  700.             GOTO GETPATHL1
  701.         END IF
  702.         UIPop 1
  703.  
  704.         ''Truncate display if too long.
  705.         IF LEN(destDir$) > 23 THEN
  706.             ReplaceListItem "DriveStatusText", 7, MID$(destDir$, 1, 23)+"..."
  707.         ELSE
  708.             ReplaceListItem "DriveStatusText", 7, destDir$
  709.         END IF
  710.  
  711.         olddest$ = ""
  712.  
  713.         result% = SetDriveStatus(1)
  714.         GOTO CUSTINST
  715.     ELSEIF sz$ = "REACTIVATE" THEN
  716.         GOTO GETPATHL1
  717.     ELSEIF sz$ = "EXIT" THEN
  718.         GOSUB ASKQUIT
  719.         GOTO GETPATHL1
  720.      ELSEIF sz$ = "BACK" THEN
  721.         UIPop 1
  722.         GOTO CUSTINST
  723.     ELSE
  724.         UIPop 1
  725.         GOTO CUSTINST
  726.     END IF
  727.  
  728.  
  729.  
  730. '**
  731. '** Purpose:
  732. '**     Appends a file name to the end of a directory path,
  733. '**     inserting a backslash character as needed.
  734. '** Arguments:
  735. '**     szDir$  - full directory path (with optional ending "\")
  736. '**     szFile$ - filename to append to directory
  737. '** Returns:
  738. '**     Resulting fully qualified path name.
  739. '*************************************************************************
  740. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  741.     IF szDir$ = "" THEN
  742.         MakePath = szFile$
  743.     ELSEIF szFile$ = "" THEN
  744.         MakePath = szDir$
  745.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  746.         MakePath = szDir$ + szFile$
  747.     ELSE
  748.         MakePath = szDir$ + "\" + szFile$
  749.     END IF
  750. END FUNCTION
  751.  
  752.  
  753. FUNCTION InstantString (varStr$) STATIC AS STRING
  754.  
  755.     newStr$ = ""
  756.  
  757.     strLen% = LEN(varStr$)
  758.     IF strLen = 0 THEN
  759.         GOTO INSTANTSTRINGEXIT
  760.     END IF
  761.  
  762.     strHead% = 1
  763.     WHILE (strHead% > 0)
  764.         dollarPos1% = INSTR(strHead%,varStr$,"$")
  765.         IF dollarPos1% > 0 THEN
  766.             newStr$ = newStr$+MID$(varStr$,strHead%,dollarPos1%-strHead%)
  767.             dollarPos2% = INSTR(dollarPos1% + 1,varStr$,"$")
  768.             IF dollarPos2% > 0 THEN
  769.                 var$ = MID$(varStr$,dollarPos1% + 1,dollarPos2% - dollarPos1%)
  770.                 strHead% = dollarPos2%+1
  771.                 IF strHead% > LEN(varStr$) THEN
  772.                     strHead% = 0
  773.                 END IF
  774.             ELSE
  775.                 var$ = MID$(varStr$,dollarPos1% + 1)
  776.                 strHead% = 0
  777.             END IF
  778.  
  779.             newStr$ = newStr$+GetSymbolValue(UCASE$(var$))
  780.         ELSE
  781.             newStr$ = newStr$+MID$(varStr$,strHead%)
  782.             strHead% = 0
  783.         END IF
  784.     WEND
  785.  
  786. INSTANTSTRINGEXIT:
  787.     InstantString = newStr$
  788.  
  789. END FUNCTION
  790.  
  791.  
  792. FUNCTION AddDirToCopyList(theFile$,dir$,srcDir$,dstDir$,silent%) STATIC AS INTEGER
  793.  
  794.     result% = 0
  795.  
  796.     IF srcDir$ = "" THEN
  797.         GOTO ADDDIRTOCOPYLISTEXIT
  798.     END IF
  799.  
  800.     IF dstDir$ = "" THEN
  801.         GOTO ADDDIRTOCOPYLISTEXIT
  802.     END IF
  803.  
  804.     baseSym$ = MID$(dir$,2,6)
  805.     SetSymbolValue baseSym$,srcDir$
  806.     newSrcDir$ = InstantString(dir$)
  807.     SetSymbolValue baseSym$,dstDir$
  808.     newDstDir$ = InstantString(dir$)
  809.  
  810.     IF dir$ = "$BASE0$" THEN
  811. ''    IF MID$(dir$,1,1) = "$" AND LEN(dir$) = 7 THEN
  812.         RemoveSymbol "DIRLIST"
  813.         RemoveSymbol "NEWDIRLIST"
  814.     END IF
  815.  
  816.     IF DoesDirExist(newDstDir$) = 0 THEN
  817.         AddListItem "DIRLIST",""
  818.         AddListItem "NEWDIRLIST",dir$
  819.     ELSE
  820.         AddListItem "DIRLIST",dir$
  821.         AddListItem "NEWDIRLIST",""
  822.     END IF
  823.  
  824.     IF DoesIniSectionExist(theFile$,dir$) = 1 THEN
  825.         IF silent% = 0 THEN
  826.             i% = 0
  827.             key$ = "f"+RTRIM$(LTRIM$(STR$(i%)))
  828.             curFile$ = GetIniKeyString(theFile$,dir$,""""+key$+"""")
  829.             curFile$ = GetNthFieldFromIniString(curFile$,2)
  830.             halt% = 0
  831.  
  832.             SetSymbolValue "CENTERWINDOW", "BOTH"
  833.  
  834.             WHILE curFile$ <> "" AND halt% = 0
  835.                 fileExists% = DoesFileExist(newDstDir$+"\"+curFile$,femExists)
  836.                 IF fileExists% = 1 AND replaceAll% = 0 THEN
  837.                     SetSymbolValue filePathID$,newDstDir$+"\"+curFile$
  838.                     sz$ = UIStartDlg(CUIDLL$, DUPFILE, "FInfoDlgProc", 0, "")
  839.                     IF sz$ = "CONTINUE" THEN ''this translates to "replace"
  840.                         AddSectionKeyFileToCopyList dir$,key$,newSrcDir$,newDstDir$
  841.                     ELSEIF sz$ = "EXIT" THEN ''this translates to "replace ALL"
  842.                         AddSectionKeyFileToCopyList dir$,key$,newSrcDir$,newDstDir$
  843.                         replaceAll% = 1
  844.                     ELSEIF sz$ = "CANCEL" THEN ''this translates to "stop"
  845.                         halt% = 1
  846.                         result% = 1
  847.                         UIPop 1
  848.                         GOTO ADDDIRTOCOPYLISTEXIT
  849.                     END IF
  850.                     UIPop 1
  851.                 ELSE
  852.                     AddSectionKeyFileToCopyList dir$,key$,newSrcDir$,newDstDir$
  853.                 END IF
  854.  
  855.                 i% = i% + 1
  856.                 key$ = "f"+RTRIM$(LTRIM$(STR$(i%)))
  857.                 curFile$ = GetIniKeyString(theFile$,dir$,""""+key$+"""")
  858.                 curFile$ = GetNthFieldFromIniString(curFile$,2)
  859.             WEND
  860.         ELSE
  861.             AddSectionFilesToCopyList dir$,newSrcDir$,newDstDir$
  862.         END IF
  863.     END IF
  864.  
  865.     IF DoesIniSectionExist(theFile$,dir$+"\") = 1 THEN
  866.         subDirStr$ = GetIniKeyString(theFile$,dir$+"\","""subdirs""")
  867.         i% = 1
  868.         subDir$ = GetNthFieldFromIniString(subDirStr$,i%)
  869.         WHILE subDir$ <> ""
  870.             subDir$ = dir$+"\"+subDir$
  871.             result% = AddDirToCopyList(theFile$,subDir$,srcDir$,dstDir$,silent%)
  872.             IF result% = 1 THEN
  873.                 GOTO ADDDIRTOCOPYLISTEXIT
  874.             END IF
  875.             i% = i% + 1
  876.             subDir$ = GetNthFieldFromIniString(subDirStr$,i%)
  877.         WEND
  878.     END IF
  879.  
  880. ADDDIRTOCOPYLISTEXIT:
  881.     AddDirToCopyList = result%
  882. END FUNCTION
  883.  
  884.  
  885. FUNCTION SetDriveStatus(silent%) STATIC AS INTEGER
  886.  
  887. ''Drive Status Text fields:
  888. ''    1:    installation drive
  889. ''    2:    install drive space required
  890. ''    3:    install drive space available
  891. ''    4:    Windows drive
  892. ''    5:    Windows drive space required
  893. ''    6:    Windows drive space available
  894. ''    7:    Installation path
  895.  
  896.     result% = 0
  897.  
  898.     ''CALCULATE COSTS
  899.     ClearCopyList
  900.     replaceAll% = 0
  901.     result% = AddDirToCopyList (szInf$,"$BASE0$",sourceDir$,destDir$,silent%)
  902.     IF result% = 1 THEN
  903.         ClearCopyList
  904.         GOTO SETDRIVESTATUSEXIT
  905.     END IF
  906.  
  907.     ''ADD FILES DESTINED FOR THE WINDOWS DIRECTORY
  908.     ''SPECIAL NOTE: THIS CRAPPY MSSETUP CAN'T DEAL WITH THE PATH WINDOWS\SYSTEM,
  909.     ''SO FILES DESTINED FOR THE WINDOWS\SYSTEM DIRECTORY SHOULD BE INCLUDED HERE
  910.     IF wingNeeded% = 1 THEN
  911.         IF GetWindowsMajorVersion() = 3 AND GetWindowsMinorVersion() < 20 THEN
  912.             AddSectionFilesToCopyList "$WINDOWS$",sourceDir$,GetWindowsDir()
  913.         END IF
  914.     END IF
  915.  
  916.     i% = 0
  917.     tmpSrcDirStr$ = srcDirStr$
  918.     WHILE tmpSrcDirStr$ <> ""
  919.         temp% = INSTR(tmpSrcDirStr$,",")
  920.         IF temp% > 0 THEN
  921.             curSrcDir$ = MID$(tmpSrcDirStr$,1,temp%-1)
  922.             tmpSrcDirStr$ = MID$(tmpSrcDirStr$,temp%+1)
  923.         ELSE
  924.             curSrcDir$ = MID$(tmpSrcDirStr$,1)
  925.             tmpSrcDirStr$ = ""
  926.         END IF
  927.         i% = i% + 1
  928.         baseStr$ = "$BASE"+RTRIM$(LTRIM$(STR$(i%)))+"$"
  929.         result% = AddDirToCopyList (szInf$,baseStr$,curSrcDir$,destDir$,silent%)
  930.         IF result% = 1 THEN
  931.             ClearCopyList
  932.             GOTO SETDRIVESTATUSEXIT
  933.         END IF
  934.     WEND
  935.     ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  936. ''    ReplaceListItem "ExtraCosts", ndrive%, "10240"
  937.     ReplaceListItem "ExtraCosts", ndrive%, RTRIM$(LTRIM$(STR$(GetNetPGSize(cfgFile$))))
  938.  
  939.     ExcessNeeded& = GetCopyListCost("ExtraCosts", "AppNeeds", "")
  940.  
  941.     drive$ = MID$(destDir$, 1, 1)
  942.     ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  943.  
  944.     cost& = VAL(GetListItem("AppNeeds", ndrive%))
  945.     IF cost& < 0 THEN
  946.         cost& = 0
  947.     END IF
  948.     free& = GetFreeSpaceForDrive(drive$)
  949.     IF free& < 0 THEN
  950.         free& = 0
  951.     END IF
  952.  
  953.     ReplaceListItem "DriveStatusText", 1, drive$ + ":"
  954.     ReplaceListItem "DriveStatusText", 2, STR$(cost& / 1024) + " K"
  955.     ReplaceListItem "DriveStatusText", 3, STR$(free& / 1024) + " K"
  956.  
  957.     IF drive$ <> WINDRIVE$ THEN
  958.         ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  959.         cost& = VAL(GetListItem("AppNeeds", ndrive%))
  960.         IF cost& < 0 THEN
  961.             cost& = 0
  962.         END IF
  963.     ELSE
  964.         cost& = 0
  965.     END IF
  966.     IF cost& <> 0 THEN
  967.         free& = GetFreeSpaceForDrive(WINDRIVE$)
  968.         ReplaceListItem "DriveStatusText", 4, WINDRIVE$ + ":"
  969.         ReplaceListItem "DriveStatusText", 5, STR$(cost& / 1024) + " K"
  970.         ReplaceListItem "DriveStatusText", 6, STR$(free& / 1024) + " K"
  971.     ELSE
  972.         ReplaceListItem "DriveStatusText", 4, ""
  973.         ReplaceListItem "DriveStatusText", 5, ""
  974.         ReplaceListItem "DriveStatusText", 6, ""
  975.     END IF
  976.  
  977. SETDRIVESTATUSEXIT:
  978.     SetDriveStatus = result%
  979. END FUNCTION
  980.  
  981.  
  982. SUB DeinstFiles STATIC
  983.  
  984.     listLen% = GetListLength("DIRLIST")
  985.     IF listLen% = 0 THEN
  986.         GOTO DEINSTFILESEXIT
  987.     END IF
  988.  
  989.      clearDirList% = 1
  990.     clearNewDirList% = 1
  991.     SetSymbolValue "BASE0$",destDir$
  992.     FOR i% = listLen% TO 1 STEP -1
  993.         theDir$ = GetListItem("DIRLIST",i%)
  994.         IF theDir$ <> "" THEN
  995.             theNewDir$ = GetListItem("NEWDIRLIST",i%)
  996.             IF theNewDir$ <> "" THEN
  997.                 result% = DeleteDirectory(theDir$,1)
  998.                 IF result% = 1 THEN
  999.                     clearNewDirList% = 0
  1000.                 ELSE
  1001.                     ReplaceListItem "DIRLIST",i%,""
  1002.                 END IF
  1003.             ELSE
  1004.                 clearDirList% = 0
  1005.                 IF filesInstalled% = 1 THEN
  1006.                     junk% = DeinstallFiles(InstantString(theDir$),szInf$,theDir$,0)
  1007.                 END IF
  1008.             END IF
  1009.         END IF
  1010.     NEXT
  1011.     RemoveSymbol "BASE0$"
  1012.     IF clearNewDirList% = 1 THEN
  1013.         RemoveSymbol "NEWDIRLIST"
  1014.         IF clearDirList% = 1 THEN
  1015.             RemoveSymbol "DIRLIST"
  1016.         END IF
  1017.     END IF
  1018.  
  1019.     filesInstalled% = 0
  1020.  
  1021. DEINSTFILESEXIT:
  1022. END SUB
  1023.  
  1024.  
  1025. FUNCTION ParseCommand (commFlag$) STATIC AS STRING
  1026.  
  1027.     ParseCommand = ""
  1028.  
  1029.     a% = INSTR(COMMAND$,"/"+commFlag$)
  1030.     IF a% = 0 THEN
  1031.         GOTO PARSECOMMANDEXIT
  1032.     END IF
  1033.  
  1034.     b% = INSTR(a%+1,COMMAND$,"/")
  1035.     IF b% > 0 THEN
  1036.         temp$ = MID$(COMMAND$,a%,b%-a%)
  1037.         C$ = MID$(COMMAND$,b%)
  1038.     ELSE
  1039.         temp$ = MID$(COMMAND$,a%)
  1040.         C$ = ""
  1041.     END IF
  1042.     IF a% > 1 THEN
  1043.         D$ = MID$(COMMAND$,1,a%-1)
  1044.     ELSE
  1045.         D$ = ""
  1046.     END IF
  1047.     COMMAND$ = D$+C$
  1048.     ParseCommand = RTRIM$(LTRIM$(MID$(temp$,3)))
  1049.  
  1050. PARSECOMMANDEXIT:
  1051. END FUNCTION
  1052.  
  1053.  
  1054. SUB DoRegistrations STATIC
  1055.  
  1056.     MakeListFromSectionKeys "REGLIST","REGEDIT"
  1057.     listLen% = GetListLength("REGLIST")
  1058.     IF listLen% = 0 THEN
  1059.         GOTO DOREGISTRATIONSEXIT
  1060.     END IF
  1061.  
  1062.     FOR i%=1 TO listLen% STEP 1
  1063.         key$ = GetListItem("REGLIST",i%)
  1064.         keyValue$ = GetIniKeyString(szInf$,"REGEDIT",""""+key$+"""")
  1065.  
  1066.         IF INSTR(LEN(sourceDir$),destDir$,"\") > 0 THEN
  1067.             tempString$ = MID$(destDir$,1,LEN(destDir$)-1)
  1068.         ELSE
  1069.             tempString$ = destDir$
  1070.         END IF
  1071.         SetSymbolValue "INSTALLTODIR$",tempString$
  1072.         IF INSTR(LEN(sourceDir$),sourceDir$,"\") > 0 THEN
  1073.             tempString$ = MID$(sourceDir$,1,LEN(sourceDir$)-1)
  1074.         ELSE
  1075.             tempString$ = sourceDir$
  1076.         END IF
  1077.         SetSymbolValue "INSTALLFROMDIR$",tempString$
  1078.         SetSymbolValue "WINDOWS$",MID$(GetWindowsDir(),1,LEN(GetWindowsDir())-1)
  1079.         SetSymbolValue "WINSYS$",MID$(GetWindowsSysDir(),1,LEN(GetWindowsSysDir())-1)
  1080.  
  1081.         CreateRegKey key$
  1082.         CreateRegKeyValue key$,InstantString(keyValue$)
  1083.     NEXT
  1084.  
  1085. DOREGISTRATIONSEXIT:
  1086. END SUB
  1087.